<!DOCTYPE HTML>
<html>
<head>
  <?php include("res/head.php"); ?>
</head>

<body>

<?php include("res/social.php"); ?>

<div class="menu">  
  <div class="container clearfix">

    <div id="logo" class="grid_3">
      <img src="/images/demo_logo.png">
    </div>
    
    <div id="nav" class="grid_9 omega">
      <a href="#" class="pull-right cart" onClick="cart()"><img src="/images/cart.png" /></a>
      <ul class="navigation">
        <li data-slide="1">Акция дня</li>
        <li data-slide="2" onmouseover="category()" onmouseout="leftCategory()" id="categories">Категории <i>▼</i></li>
        <li data-slide="3">Помощь</li>
        <?php 
        if(!($session_name)) { 
          echo "<li id='singin' onclick=\"change_location('/wow/home/signin')\">Войти</li>";
        }
        else { 
          echo "<li id='singin' onclick=\"change_location('/wow/home/logout')\">Выйти</li>";
        }

        ?>
      </ul>
    </div>
  
  </div>

  <div class="categories-container" onmouseover="categories()" onmouseout="leftCategories()">
    <?php 
      foreach ($categories as $category) {
        ?> <a href="/wow/home/all/#<?php echo $category->id + 10?>"><div class="category"><?php echo $category->name ?> </div></a> <?php
      }
     ?>
     <a href="/wow/home/all/"><div class="category">Все </div></a>
  </div>

  <div class="cart-container"> 

    <div id="content" class="grid_12 relative-holder">
      <h1>Корзина пока пуста</h1>
    </div>
  
  </div>

</div>

<div class="slide" id="slide2" data-slide="1" data-stellar-background-ratio="0.5">
  <div class="container clearfix">  

    <div id="content" class="grid_12 relative-holder">
      <img src="/images/iphone5-cropped.png" class="pull-right"/>

      <h1 class="green-back">iPhone 5</h1>
      <h2>Теперь по вашей цене</h2>

      <p> <br />
        <a href="/wow/deal/id/4" class="btn">Подробнее <b class="btn-arrow">→</b></a>
      </p>
    </div>
  
  </div>
</div>



<div class="slide" id="slide3" data-slide="2">
  <div class="container clearfix">

  <?php 
  $count = 0;
  $sec_adeal = null;
  foreach ($adeals as $adeal) {
     $count = ($count + 1);
     ?> 
    <div class="grid_6_modified" data-desc="<?php echo $count ?>">
      <img src="<?php echo $adeal->img_url ?>" />
      <div class="deal-header">
        <p class="header"><?php echo $adeal->title ?> <i data-discount="<?php echo $adeal->sale ?>"><?php echo $adeal->sale ?>%</i></p>
      </div>
      <div class="deal-selected">
      </div>
    </div>
    <?php
    if($count % 2 == 0) { ?>
      <div class="grid_12 desc-holder" data-descholder="<?php echo $count - 1 ?>">
        <div class="desc-bg">
          <div class="description container">
            <div class="grid_12 desc-grid">
                <p><?php echo $sec_adeal->title ?></p>
            </div>
            <div class="grid_6 desc-grid">
              <img src="<?php echo $sec_adeal->img_url ?>" />
            </div>
            <div class="grid_6 desc-grid">
              <h5>Скидка:</h5>
              <h3><?php echo $sec_adeal->sale ?>%</h3>
              <h5 style="margin-top:20px;">Цена купона:</h5>
              <h3><?php echo $sec_adeal->s_cost - ($sec_adeal->i_cost / 100 * (100 - $sec_adeal->sale))  ?> тг</h3>
              <h5 style="margin-top:20px;">Стоимость услуги(товара):</h5>
              <h3><?php echo $sec_adeal->s_cost ?> тг (экономия <?php echo $sec_adeal->i_cost - $sec_adeal->s_cost ?> тг)</h3>
              <br />
              <a href="/wow/deal/id/<?php echo $sec_adeal->id ?>" class="btn">Перейти <b class="btn-arrow">→</b></a>
            </div>
          </div>
        </div>
      </div>
      <div class="grid_12 desc-holder" data-descholder="<?php echo $count ?>">
        <div class="desc-bg">
          <div class="description container">
            <div class="grid_12 desc-grid">
                <p><?php echo $adeal->title ?></p>
            </div>
            <div class="grid_6 desc-grid">
              <img src="<?php echo $adeal->img_url ?>" />
            </div>
            <div class="grid_6 desc-grid">
              <h5>Скидка:</h5>
              <h3><?php echo $adeal->sale ?>%</h3>
              <h5 style="margin-top:20px;">Цена купона:</h5>
              <h3><?php echo $adeal->s_cost - ($adeal->i_cost / 100 * (100 - $adeal->sale))  ?> тг</h3>
              <h5 style="margin-top:20px;">Стоимость услуги(товара):</h5>
              <h3><?php echo $adeal->s_cost ?> тг (экономия <?php echo $adeal->i_cost - $adeal->s_cost ?> тг)</h3>
              <br />
              <a href="/wow/deal/id/<?php echo $adeal->id ?>" class="btn">Перейти <b class="btn-arrow">→</b></a>
            </div>
          </div>
        </div>
      </div>
    <?php
    }
    $sec_adeal = $adeal;
  } 

  if($count % 2 != 0) {
    ?>
    <div class="grid_12 desc-holder" data-descholder="<?php echo $count ?>">
        <div class="desc-bg">
          <div class="description container">
            <div class="grid_12 desc-grid">
                <p><?php echo $sec_adeal->title ?></p>
            </div>
            <div class="grid_6 desc-grid">
              <img src="<?php echo $sec_adeal->img_url ?>" />
            </div>
            <div class="grid_6 desc-grid">
              <h5>Скидка:</h5>
              <h3><?php echo $sec_adeal->sale ?>%</h3>
              <h5 style="margin-top:20px;">Цена купона:</h5>
              <h3><?php echo $sec_adeal->s_cost - ($sec_adeal->i_cost / 100 * (100 - $sec_adeal->sale))  ?> тг</h3>
              <h5 style="margin-top:20px;">Стоимость услуги(товара):</h5>
              <h3><?php echo $sec_adeal->s_cost ?> тг (экономия <?php echo $sec_adeal->i_cost - $sec_adeal->s_cost ?> тг)</h3>
              <br />
              <a href="/wow/deal/id/<?php echo $sec_adeal->id ?>" class="btn">Перейти <b class="btn-arrow">→</b></a>
            </div>
          </div>
      </div>
    </div>
  <?php } ?>    
    

    <div class="grid_12 text-center">
      <h3></h3>
      <a href="/wow/home/all" class="btn">Остальные акции <b class="btn-arrow">→</b></a>
    </div>
  </div>
</div>


<?php include("res/footer.php"); ?>

</body>
</html>
